<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
//车辆保养
class CreateMaintenancesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */

    public function up()
    {
        Schema::create('maintenances', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('car_id')->default(0)->comment('车辆id');
            $table->timestamp('need_start')->nullable()->comment('所需时间开始');
            $table->timestamp('need_end')->nullable()->comment('所需时间结束');
            $table->timestamp('start')->nullable()->comment('起始时间');
            $table->timestamp('end')->nullable()->comment('结束时间');
            $table->float('mileage',10,2)->default(0.00)->comment('公里数');
            $table->string('address')->nullable()->comment('保养地点');
            $table->decimal('price',10,2)->default(0.00)->comment('保养费用');
            $table->text('contents')->nullable()->comment('项目');
            $table->text('images')->nullable()->comment('图片');
            $table->string('name')->nullable()->comment('车名称');
            $table->string('category')->nullable()->comment('车系');
            $table->string('data')->nullable()->comment('车参数：如变速箱');
            $table->string('label')->nullable()->comment('车标签');
            $table->text('pic')->nullable()->comment('车图片');
            $table->integer('lease_times')->default(0)->comment('租车次数');
            $table->string('descript')->nullable()->comment('简介');
            $table->integer('stock')->default(1)->comment('库存数量');
            $table->tinyInteger('status')->default(1)->comment('车辆状态 -1：下架，0：已经售罄 1：上架 ');
            $table->longText('drink')->nullable()->comment('随车饮料');
            $table->longText('non_lease_date')->nullable()->comment('不可租日期');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('maintenances');
    }
}
